-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use daggy's StableDag #147
base: master
Are you sure you want to change the base?
Conversation
Fix RustAudio#103. Use the StableDag structure which (which uses petgraph's StableGraph) implements a directed acyclic graph with stable indices.
Use the new Walker API.
for connection in self.dag.edge_weights_mut() { | ||
let edge_ids = self.edge_references().map(|e| e.id()).collect::<Vec<_>>(); | ||
for edge_id in edge_ids { | ||
let connection = self.connection_mut(edge_id).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this also means that we cannot mutably iterate the graph's nodes/edges directly (yet). To address this, I have implemented this workaround which is slightly less efficient.
@@ -19,7 +19,7 @@ name = "dsp" | |||
path = "./src/lib.rs" | |||
|
|||
[dependencies] | |||
daggy = "0.4.0" | |||
daggy = { git = "https://github.com/mitchmindtree/daggy", rev = "bcb36c7b", features = ["stable_dag"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, we might want to update to the next proper version of daggy
once it is released to crates.io.
The EdgeRef trait provides information about the edges returned by Graph::edge_references.
Using
StableDag
should fix the index-shifting behavior, which previously occurred when nodes were removed from the graph.There are a few API-breaking changes with this solution, however:
raw_nodes
is replaced bynode_references
raw_edges
is replaced byedge_references
Walker
'snext_node
andnext_edge
are replaced bywalk_next
(as defined by the upstream API)